package com.sq.loginservice.controller.exception;

import com.sq.common.exception.server.ServiceException;
import com.sq.common.web.domain.AjaxResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author Li sir
 * @Date 2024/9/30
 */

@RestControllerAdvice
public class GlobalExceptionHandler {


    /**
     * 服务运行异常
     */
    @ExceptionHandler(ServiceException.class)
    public AjaxResult execServerException(ServiceException e){
        return AjaxResult.error(e.getMessage());
    }

}
